package cn.doitedu.datayi.data_service.controller;

import cn.doitedu.datayi.data_service.po.TrafficKylinCubeQueryBean;
import cn.doitedu.datayi.data_service.service.KylinDemoProjectService;
import cn.doitedu.datayi.data_service.vo.KylinDemoVo;
import cn.doitedu.datayi.data_service.vo.SessionQueryVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class KylinDemoProjectController {
    @Autowired
    KylinDemoProjectService kylinDemoProjectService;

    @RequestMapping("/api/vi/kylin/pvquery")
    public KylinDemoVo query() throws Exception{

        KylinDemoVo vo = new KylinDemoVo();

        try {
            List<TrafficKylinCubeQueryBean> data = kylinDemoProjectService.query();
            vo.setData(data);
            vo.setStatus(200);
            vo.setMsg("success");
        }catch(Exception e){
            vo.setStatus(-1);
            vo.setMsg("kylin query failed");
        }

        return vo;
    }
}
